package fr.upmc.i3s.fuglmeyeranalyser.curves;

import java.awt.Color;

import org.math.plot.Plot2DPanel;
import org.math.plot.canvas.Plot2DCanvas;

public class Plot2DPanel2 extends Plot2DPanel {

	private static final long serialVersionUID = 2957779157640325415L;

	@Override
	public int addLinePlot(String name, Color color, double[] X, double[] Y) {
		if(X.length == Y.length)
			return ((Plot2DCanvas) plotCanvas).addLinePlot(name, color, X,Y);
		else{
			if(X.length < Y.length){
				double[] newY = new double[X.length];
				for(int i=0;i<X.length;i++)
					newY[i]=Y[i];
				return ((Plot2DCanvas) plotCanvas).addLinePlot(name, color, X,newY);
			}
			else{
				double[] newX = new double[Y.length];
				for(int i=0;i<Y.length;i++)
					newX[i]=X[i];
				return ((Plot2DCanvas) plotCanvas).addLinePlot(name, color, newX,Y);
			}
		}
    }

}
